/********************************************************************
	created:	2012/02/26   13:24
	filename: 	gate_service.h
	author:		zxh
	
	purpose:	
*********************************************************************/
#ifndef _HY_GATE_SERVICE_H_
#define _HY_GATE_SERVICE_H_

#include <map>
#include "hy_server_base.h"
#include "gate_net_module.h"

class gate_service : public hy_service_base
{
	
public:
	gate_service();
	~gate_service();

	virtual hy_err_t init()
	{
		hy_module_base* net_module = new gate_net_module();
		net_module->init();
		//map["net"] = net_module;

		return hy_right;
	}

	virtual hy_err_t unit()
	{
		return hy_right;
	}

	virtual void run()
	{
		for (modules_t::iterator itor = _modules.begin();
			itor != _modules.end();
			itor++ )
		{
			(itor->second)->run();
		}
	}

	virtual void stop()
	{

	}
private:
	typedef std::map<std::string, hy_module_base*>	modules_t;
	modules_t	_modules;
};

#endif  //_HY_GATE_SERVICE_H_
